<!--
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-06-08 07:51:53
 * @LastEditTime: 2019-10-10 11:09:05
 * @LastEditors: Please set LastEditors
 -->
<template>
  <view class="my-page">
    <view class="box">
      <view class="person-info">
        <view class="person-pos">
          <view class="header">
		    <image v-if="headerImage==undefined||headerImage==''"
			  src="../static/images/icon_header.png"
			  mode="scaleToFill"
			  lazy-load="false">
			</image>
			 <image v-else
			  :src="headerImage"
			  mode="scaleToFill"
			  lazy-load="false">
			</image>
		  </view>
          <view>
            <view class="user-name">{{mobile}}</view>
            <view class="greet">尊贵的会员</view>
			<view class="join">欢迎加入我们</view>
          </view>
        </view>
      </view>
    </view>
	<view class="menu-list">
	   <view class="item" v-for="(item,index) in entry" :key="index" :data-url="item.entryUrl" @click="navigateUrl">
		    <view class="icon-lf">
				 <image
				  :src="item.icon"
				  mode="scaleToFill"
				  lazy-load="false">
				</image> 
				 <view class="line"></view>
	       		 <view>{{item.entryName}}</view>
			</view>
			<view>
			    <image
			      class="arrow-rt"
				  src="../static/images/icon_arrow_right.png"
				  mode="scaleToFill"
				  lazy-load="false">
				</image>
			</view>
	   </view>
	</view>
  </view>
</template>

<script>
import Vue from 'vue'
import { isLogin } from "@/common/utils/util";
import InterServer from "@/common/config/server";
export default {
  data() {
    return {
			headerImage:"", //用户头像
			mobile:"",//用户电话
			entry:[
				{
					icon:"../static/images/icon-my-follow.png",
					entryName:"我的关注",
					entryUrl:"myConcern"
				},
				{
					icon:"../static/images/icon-my-entry.png",
					entryName:"专家入驻",
					entryUrl:"dataAudit"
				},
				// {
				// 	entryName:"修改密码",
				// 	entryUrl:"resetPassword"
				// },
				{
					icon:"../static/images/icon-my-cooperation.png",
					entryName:"商务合作",
					entryUrl:"affairsCooperate"
				},{
					icon:"../static/images/icon-my-service.png",
					entryName:"联系客服",
					entryUrl:"phoneNum"
				},{
					icon:"../static/images/icon-my-about.png",
					entryName:"关于我们",
					entryUrl:"aboutUs"
				},{
					icon:"../static/images/icon-my-loginout.png",
					entryName:"退出登录",
				 	entryUrl:"outLogin"
				 },
			]
		};
  },
	onLoad() {
		},
	onShow(){
		this.headerImage=Vue.globalData.userInfo.image;
		let mobile=Vue.globalData.userInfo.mobile.replace();
		this.mobile=mobile.substr(0, 3) + '****' + mobile.substr(7);
		// #ifdef H5
				document.title=`我的`
		// #endif
		 isLogin().then(res => {
			if (res) {
			}
		})
	},
  methods: {
		 navigateUrl(e){
			 const url=e.currentTarget.dataset.url
			 if(url=="outLogin"){
				 Vue.customNavigateTo(`./login`);
				 uni.clearStorageSync();
				 return
			 }
			if(url=='phoneNum'){
				 uni.makePhoneCall({
					phoneNumber: '010-86390610' 
				});
				 return 
			 }
			 if(url=="myConcern"||url=="dataAudit"){
				isLogin().then(res=>{
					if(res){
						if(url=="dataAudit"){
							InterServer.examineCheck({

							}).then(res=>{
								console.log(res)
								if(res.code==200){
                                   if(res.data){
									   Vue.customNavigateTo(`./chatList`);
								   }else{
                                      Vue.customNavigateTo(`${url}`);
								   }
								}
							})
						}else{
							Vue.customNavigateTo(`${url}`);
						}
					}
				})
			 }else{
				 Vue.customNavigateTo(url);
			 }
     }
	}
};
</script>

<style lang="less" scoped>
.my-page {
	background: #4DCCCC;
  .box {
    height: 402upx;
    position: relative;
	margin-bottom: 48upx;
  }
  .person-info {
    width: 100%;
    height: 402upx;
    background: url("../static/images/pic_my.png");
    background-repeat: no-repeat;
    background-position: center top;
	background-size: 100% 100%;	
	text-align: center;
	
    .person-pos {
	 font-size: 28upx;
	 display: flex;
	 justify-content: center;
	 align-items: center;
	 flex-direction:column;
	 text-align: center;

    }
    .header {
       width: 160upx;
		height: 160upx;
		margin-top: 12upx;
		border-radius: 50%;
		image{
			border-radius: 50%;
			width: 100%;
			height: 100%;
		}
    }
	.user-name{
		height: 40upx;
		font-size: 28upx;
		color: #ffffff;
		font-weight: bold;
		margin: 12upx 0 28upx;
		font-family:PingFang-Semibold;
		font-weight:bold;
		line-height:40upx;
	}
	.greet{
		height:30upx;
		font-size:22upx;
		font-family:PingFang-Semibold;
		font-weight:bold;
		line-height:30upx;
		color:rgba(255,170,0,1);
	}
	.join{
		width:202upx;
		height:35upx;
		background:rgba(25,0,255,1);
		box-shadow:0px 3upx 6upx rgba(5,94,133,0.41);
		opacity:0.86;
		border-radius:20upx;
		font-size:24upx;
		font-family:PingFang-Semibold;
		font-weight:bold;
		line-height:35upx;
		color:rgba(255,255,255,1);
		margin-top: 24upx;
	}

  }
  .menu-list{
	  .item{
		display: flex;
		justify-content: space-between;
		align-items: center;
		width:702upx;
		height:68upx;
		line-height: 68upx;
		font-size:26upx;
		font-family:PingFang-Semibold;
		font-weight:bold;
		background:rgba(255,255,255,1);
		color:rgba(70,70,70,1);
		box-shadow:0px 1upx 2upx rgba(0,0,0,0.19);
		margin: 0 auto 16upx;
		padding: 0 26upx;
		.icon-lf{
			display: flex;
			align-items: center;
			image{
				width: 36upx;
				height: 36upx;
			}
			.line{
				width:2upx;
				height:28upx;
				margin: 0 24upx;
				background:rgba(78,77,77,0.15);
			}
		}
		.arrow-rt{
			width: 12upx;
			height: 21upx;
		}
	  }
  }
}
</style>

